const Koa = require('koa')
const Router = require('koa-router')
const bodyParser = require('koa-bodyparser')
const cors = require('koa2-cors')
const login = require('./api/login.js')
const chatgpt = require('./api/chatgpt.js')

const app = new Koa()
const router = new Router()

router.use('/', login.routes())
router.use('/chatgpt', chatgpt.routes())

app.use(bodyParser()).use(cors()).use(router.routes()).use(router.allowedMethods())

app.listen(3154, () => {
  console.log('server started on port 3154')
})